| OLD | NEW |
| 1 # Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org) | 1 # Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org) |
| 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 | 4 # modification, are permitted provided that the following conditions |
| 5 # are met: | 5 # are met: |
| 6 # 1. Redistributions of source code must retain the above copyright | 6 # 1. Redistributions of source code must retain the above copyright |
| 7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
| 8 # 2. Redistributions in binary form must reproduce the above copyright | 8 # 2. Redistributions in binary form must reproduce the above copyright |
| 9 # notice, this list of conditions and the following disclaimer in the | 9 # notice, this list of conditions and the following disclaimer in the |
| 10 # documentation and/or other materials provided with the distribution. | 10 # documentation and/or other materials provided with the distribution. |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 for key in sorted(flags.keys()): | 226 for key in sorted(flags.keys()): |
| 227 flag_string += self._flag_pair_to_string(key, flags[key]) + ' ' | 227 flag_string += self._flag_pair_to_string(key, flags[key]) + ' ' |
| 228 | 228 |
| 229 return flag_string.strip() | 229 return flag_string.strip() |
| 230 | 230 |
| 231 | 231 |
| 232 class ArgumentParser(object): | 232 class ArgumentParser(object): |
| 233 | 233 |
| 234 # FIXME: Move the documentation of the attributes to the __init__ | 234 # FIXME: Move the documentation of the attributes to the __init__ |
| 235 # docstring after making the attributes internal. | 235 # docstring after making the attributes internal. |
| 236 |
| 236 """Supports the parsing of check-webkit-style command arguments. | 237 """Supports the parsing of check-webkit-style command arguments. |
| 237 | 238 |
| 238 Attributes: | 239 Attributes: |
| 239 create_usage: A function that accepts a DefaultCommandOptionValues | 240 create_usage: A function that accepts a DefaultCommandOptionValues |
| 240 instance and returns a string of usage instructions. | 241 instance and returns a string of usage instructions. |
| 241 Defaults to the function that generates the usage | 242 Defaults to the function that generates the usage |
| 242 string for check-webkit-style. | 243 string for check-webkit-style. |
| 243 default_options: A DefaultCommandOptionValues instance that provides | 244 default_options: A DefaultCommandOptionValues instance that provides |
| 244 the default values for options not explicitly | 245 the default values for options not explicitly |
| 245 provided by the user. | 246 provided by the user. |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 '%s: value must be between 1 and 5' | 437 '%s: value must be between 1 and 5' |
| 437 % min_confidence) | 438 % min_confidence) |
| 438 | 439 |
| 439 if filter_value: | 440 if filter_value: |
| 440 filter_rules = self._parse_filter_flag(filter_value) | 441 filter_rules = self._parse_filter_flag(filter_value) |
| 441 else: | 442 else: |
| 442 filter_rules = [] | 443 filter_rules = [] |
| 443 | 444 |
| 444 try: | 445 try: |
| 445 validate_filter_rules(filter_rules, self._all_categories) | 446 validate_filter_rules(filter_rules, self._all_categories) |
| 446 except ValueError, err: | 447 except ValueError as err: |
| 447 self._parse_error(err) | 448 self._parse_error(err) |
| 448 | 449 |
| 449 options = CommandOptionValues(filter_rules=filter_rules, | 450 options = CommandOptionValues(filter_rules=filter_rules, |
| 450 git_commit=git_commit, | 451 git_commit=git_commit, |
| 451 diff_files=diff_files, | 452 diff_files=diff_files, |
| 452 is_verbose=is_verbose, | 453 is_verbose=is_verbose, |
| 453 min_confidence=min_confidence, | 454 min_confidence=min_confidence, |
| 454 output_format=output_format) | 455 output_format=output_format) |
| 455 | 456 |
| 456 return (paths, options) | 457 return (paths, options) |
| OLD | NEW |