| OLD | NEW |
| 1 # Copyright 2016 The LUCI Authors. All rights reserved. | 1 # Copyright 2016 The LUCI Authors. All rights reserved. |
| 2 # Use of this source code is governed under the Apache License, Version 2.0 | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
| 3 # that can be found in the LICENSE file. | 3 # that can be 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 collections | 7 import collections |
| 8 import copy | 8 import copy |
| 9 import keyword | 9 import keyword |
| 10 import re | 10 import re |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 config_object or self.c, optional=optional) | 728 config_object or self.c, optional=optional) |
| 729 | 729 |
| 730 def resource(self, *path): | 730 def resource(self, *path): |
| 731 """Returns path to a file under <recipe module>/resources/ directory. | 731 """Returns path to a file under <recipe module>/resources/ directory. |
| 732 | 732 |
| 733 Args: | 733 Args: |
| 734 path: path relative to module's resources/ directory. | 734 path: path relative to module's resources/ directory. |
| 735 """ | 735 """ |
| 736 # TODO(vadimsh): Verify that file exists. Including a case like: | 736 # TODO(vadimsh): Verify that file exists. Including a case like: |
| 737 # module.resource('dir').join('subdir', 'file.py') | 737 # module.resource('dir').join('subdir', 'file.py') |
| 738 return self._module.MODULE_DIRECTORY.join('resources', *path) | 738 return self._module.RESOURCE_DIRECTORY.join(*path) |
| 739 | 739 |
| 740 def package_repo_resource(self, *path): | 740 def package_repo_resource(self, *path): |
| 741 """Returns a resource path, where path is relative to the root of | 741 """Returns a resource path, where path is relative to the root of |
| 742 the package repo where this module is defined. | 742 the package repo where this module is defined. |
| 743 """ | 743 """ |
| 744 return self._module.PACKAGE_REPO_ROOT.join(*path) | 744 return self._module.PACKAGE_REPO_ROOT.join(*path) |
| 745 | 745 |
| 746 @property | 746 @property |
| 747 def name(self): | 747 def name(self): |
| 748 return self._module.NAME | 748 return self._module.NAME |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 """ | 928 """ |
| 929 Gets the BoundProperty version of this Property. Requires a name. | 929 Gets the BoundProperty version of this Property. Requires a name. |
| 930 """ | 930 """ |
| 931 return BoundProperty( | 931 return BoundProperty( |
| 932 self._default, self.help, self.kind, name, property_type, module, | 932 self._default, self.help, self.kind, name, property_type, module, |
| 933 self.param_name) | 933 self.param_name) |
| 934 | 934 |
| 935 class UndefinedPropertyException(TypeError): | 935 class UndefinedPropertyException(TypeError): |
| 936 pass | 936 pass |
| 937 | 937 |
| OLD | NEW |