| OLD | NEW |
| 1 # Copyright 2013-2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 from __future__ import absolute_import | 5 from __future__ import absolute_import |
| 6 import contextlib | 6 import contextlib |
| 7 import keyword | 7 import keyword |
| 8 import re | 8 import re |
| 9 import types | 9 import types |
| 10 | 10 |
| 11 from functools import wraps | 11 from functools import wraps |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 # If we're the 'root' api, inject directly into 'self'. | 363 # If we're the 'root' api, inject directly into 'self'. |
| 364 # Otherwise inject into 'self.m' | 364 # Otherwise inject into 'self.m' |
| 365 self.m = self if module is None else ModuleInjectionSite(self) | 365 self.m = self if module is None else ModuleInjectionSite(self) |
| 366 | 366 |
| 367 # If our module has a test api, it gets injected here. | 367 # If our module has a test api, it gets injected here. |
| 368 self.test_api = None | 368 self.test_api = None |
| 369 | 369 |
| 370 # Config goes here. | 370 # Config goes here. |
| 371 self.c = None | 371 self.c = None |
| 372 | 372 |
| 373 def initialize(self): |
| 374 """ |
| 375 Initializes the recipe module after it has been instantiated with all |
| 376 dependencies injected and available. |
| 377 """ |
| 378 pass |
| 379 |
| 373 def get_config_defaults(self): # pylint: disable=R0201 | 380 def get_config_defaults(self): # pylint: disable=R0201 |
| 374 """ | 381 """ |
| 375 Allows your api to dynamically determine static default values for configs. | 382 Allows your api to dynamically determine static default values for configs. |
| 376 """ | 383 """ |
| 377 return {} | 384 return {} |
| 378 | 385 |
| 379 def make_config(self, config_name=None, optional=False, **CONFIG_VARS): | 386 def make_config(self, config_name=None, optional=False, **CONFIG_VARS): |
| 380 """Returns a 'config blob' for the current API.""" | 387 """Returns a 'config blob' for the current API.""" |
| 381 return self.make_config_params(config_name, optional, **CONFIG_VARS)[0] | 388 return self.make_config_params(config_name, optional, **CONFIG_VARS)[0] |
| 382 | 389 |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 """ | 643 """ |
| 637 Gets the BoundProperty version of this Property. Requires a name. | 644 Gets the BoundProperty version of this Property. Requires a name. |
| 638 """ | 645 """ |
| 639 return BoundProperty( | 646 return BoundProperty( |
| 640 self._default, self.help, self.kind, name, property_type, module, | 647 self._default, self.help, self.kind, name, property_type, module, |
| 641 self.param_name) | 648 self.param_name) |
| 642 | 649 |
| 643 class UndefinedPropertyException(TypeError): | 650 class UndefinedPropertyException(TypeError): |
| 644 pass | 651 pass |
| 645 | 652 |
| OLD | NEW |