| OLD | NEW |
| 1 # Copyright 2015 The LUCI Authors. All rights reserved. | 1 # Copyright 2015 The LUCI Authors. All rights reserved. |
| 2 # Use of this source code is governed by the Apache v2.0 license that can be | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
| 3 # found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
| 4 | 4 |
| 5 """Defines validation rules for configuration files. | 5 """Defines validation rules for configuration files. |
| 6 | 6 |
| 7 Configurations requested with store_last_good=True are automatically validated | 7 Configurations requested with store_last_good=True are automatically validated |
| 8 against rules defined using this module. Otherwise, validation.is_defined_for | 8 against rules defined using this module. Otherwise, validation.is_defined_for |
| 9 and validation.validate can be used to validate configs in your code. | 9 and validation.validate can be used to validate configs in your code. |
| 10 | 10 |
| 11 Example: | 11 Example: |
| 12 | 12 |
| 13 # Configs foo.cfg in all project config sets must be valid protobuf messages. | 13 # Configs foo.cfg in all project config sets must be valid protobuf messages. |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 try: | 310 try: |
| 311 regex = re.compile(value) | 311 regex = re.compile(value) |
| 312 except re.error as ex: | 312 except re.error as ex: |
| 313 raise ValueError(ex.message) | 313 raise ValueError(ex.message) |
| 314 return regex.match | 314 return regex.match |
| 315 | 315 |
| 316 raise ValueError('Invalid pattern kind: %s' % kind) | 316 raise ValueError('Invalid pattern kind: %s' % kind) |
| 317 | 317 |
| 318 | 318 |
| 319 DEFAULT_RULE_SET = RuleSet() | 319 DEFAULT_RULE_SET = RuleSet() |
| OLD | NEW |