Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/command.py

Issue 2188623002: Change logging statements to not use the "%" operator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright (c) 2016 Google Inc. All rights reserved. 1 # Copyright (c) 2016 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 usage_string += " [options]" 100 usage_string += " [options]"
101 if self.argument_names: 101 if self.argument_names:
102 usage_string += " " + self.argument_names 102 usage_string += " " + self.argument_names
103 return usage_string 103 return usage_string
104 104
105 def parse_args(self, args): 105 def parse_args(self, args):
106 return self.option_parser.parse_args(args) 106 return self.option_parser.parse_args(args)
107 107
108 def check_arguments_and_execute(self, options, args, tool=None): 108 def check_arguments_and_execute(self, options, args, tool=None):
109 if len(args) < len(self.required_arguments): 109 if len(args) < len(self.required_arguments):
110 _log.error("%s required, %s provided. Provided: %s Required: %s\nS ee '%s help %s' for usage." % ( 110 _log.error("%s required, %s provided. Provided: %s Required: %s\nS ee '%s help %s' for usage.",
111 pluralize("argument", len(self.required_arguments)), 111 pluralize("argument", len(self.required_arguments)),
112 pluralize("argument", len(args)), 112 pluralize("argument", len(args)),
113 "'%s'" % " ".join(args), 113 "'%s'" % " ".join(args),
114 " ".join(self.required_arguments), 114 " ".join(self.required_arguments),
115 tool.name(), 115 tool.name(),
116 self.name)) 116 self.name)
117 return 1 117 return 1
118 return self.execute(options, args, tool) or 0 118 return self.execute(options, args, tool) or 0
119 119
120 def standalone_help(self): 120 def standalone_help(self):
121 help_text = self.name_with_arguments().ljust(len(self.name_with_argument s()) + 3) + self.help_text + "\n\n" 121 help_text = self.name_with_arguments().ljust(len(self.name_with_argument s()) + 3) + self.help_text + "\n\n"
122 if self.long_help: 122 if self.long_help:
123 help_text += "%s\n\n" % self.long_help 123 help_text += "%s\n\n" % self.long_help
124 help_text += self.option_parser.format_option_help(optparse.IndentedHelp Formatter()) 124 help_text += self.option_parser.format_option_help(optparse.IndentedHelp Formatter())
125 return help_text 125 return help_text
126 126
(...skipping 20 matching lines...) Expand all
147 # This method is overridden to add this one line to the output: 147 # This method is overridden to add this one line to the output:
148 error_message += "\nType \"%s --help\" to see usage.\n" % self.get_prog_ name() 148 error_message += "\nType \"%s --help\" to see usage.\n" % self.get_prog_ name()
149 self.exit(1, error_message) 149 self.exit(1, error_message)
150 150
151 # We override format_epilog to avoid the default formatting which would para graph-wrap the epilog 151 # We override format_epilog to avoid the default formatting which would para graph-wrap the epilog
152 # and also to allow us to compute the epilog lazily instead of in the constr uctor (allowing it to be context sensitive). 152 # and also to allow us to compute the epilog lazily instead of in the constr uctor (allowing it to be context sensitive).
153 def format_epilog(self, epilog): # pylint: disable=unused-argument 153 def format_epilog(self, epilog): # pylint: disable=unused-argument
154 if self.epilog_method: 154 if self.epilog_method:
155 return "\n%s\n" % self.epilog_method() 155 return "\n%s\n" % self.epilog_method()
156 return "" 156 return ""
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698