Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2009 Google Inc. All rights reserved. | 1 # Copyright (c) 2009 Google Inc. All rights reserved. |
| 2 # Copyright (c) 2009 Apple Inc. All rights reserved. | 2 # Copyright (c) 2009 Apple Inc. All rights reserved. |
| 3 # | 3 # |
| 4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
| 5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
| 6 # met: | 6 # met: |
| 7 # | 7 # |
| 8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
| 9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
| 10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 | 107 |
| 108 def path(self): | 108 def path(self): |
| 109 raise NotImplementedError, "subclasses must implement" | 109 raise NotImplementedError, "subclasses must implement" |
| 110 | 110 |
| 111 def command_completed(self): | 111 def command_completed(self): |
| 112 pass | 112 pass |
| 113 | 113 |
| 114 def should_show_in_main_help(self, command): | 114 def should_show_in_main_help(self, command): |
| 115 return command.show_in_main_help | 115 return command.show_in_main_help |
| 116 | 116 |
| 117 def should_execute_command(self, command): | 117 def should_execute_command(self, command): # Argument may be used in subcla sses - pylint: disable=unused-argument |
| 118 return True | 118 return True |
|
qyearsley
2016/06/02 16:41:32
This is a case where there's only one subclass (We
Dirk Pranke
2016/06/02 17:52:03
If there's only one subclass we should just merge
| |
| 119 | 119 |
| 120 def _add_global_options(self, option_parser): | 120 def _add_global_options(self, option_parser): |
| 121 global_options = self.global_options or [] | 121 global_options = self.global_options or [] |
| 122 for option in global_options: | 122 for option in global_options: |
| 123 option_parser.add_option(option) | 123 option_parser.add_option(option) |
| 124 | 124 |
| 125 def handle_global_options(self, options): | 125 def handle_global_options(self, options): |
| 126 pass | 126 pass |
| 127 | 127 |
| 128 def main(self, argv=sys.argv): | 128 def main(self, argv=sys.argv): |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 146 | 146 |
| 147 while True: | 147 while True: |
| 148 try: | 148 try: |
| 149 result = command.check_arguments_and_execute(options, args, self ) | 149 result = command.check_arguments_and_execute(options, args, self ) |
| 150 break | 150 break |
| 151 except TryAgain, e: | 151 except TryAgain, e: |
| 152 pass | 152 pass |
| 153 | 153 |
| 154 self.command_completed() | 154 self.command_completed() |
| 155 return result | 155 return result |
| OLD | NEW |