Joshua Hesketh | ffe4206 | 2014-09-05 21:43:52 +1000 | [diff] [blame] | 1 | # Copyright 2014 Rackspace Australia |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 | # not use this file except in compliance with the License. You may obtain |
| 5 | # a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations |
| 13 | # under the License. |
| 14 | |
| 15 | import abc |
| 16 | |
| 17 | import six |
| 18 | |
| 19 | |
| 20 | @six.add_metaclass(abc.ABCMeta) |
| 21 | class BaseReporter(object): |
| 22 | """Base class for reporters. |
| 23 | |
| 24 | Defines the exact public methods that must be supplied. |
| 25 | """ |
| 26 | |
Joshua Hesketh | 352264b | 2015-08-11 23:42:08 +1000 | [diff] [blame^] | 27 | def __init__(self, reporter_config={}, sched=None, connection=None): |
| 28 | self.reporter_config = reporter_config |
| 29 | self.sched = sched |
| 30 | self.connection = connection |
| 31 | |
| 32 | def stop(self): |
| 33 | """Stop the reporter.""" |
Joshua Hesketh | ffe4206 | 2014-09-05 21:43:52 +1000 | [diff] [blame] | 34 | |
| 35 | @abc.abstractmethod |
Joshua Hesketh | 352264b | 2015-08-11 23:42:08 +1000 | [diff] [blame^] | 36 | def report(self, source, change, message): |
Joshua Hesketh | ffe4206 | 2014-09-05 21:43:52 +1000 | [diff] [blame] | 37 | """Send the compiled report message.""" |
| 38 | |
Joshua Hesketh | 352264b | 2015-08-11 23:42:08 +1000 | [diff] [blame^] | 39 | def getSubmitAllowNeeds(self): |
Joshua Hesketh | ffe4206 | 2014-09-05 21:43:52 +1000 | [diff] [blame] | 40 | """Get a list of code review labels that are allowed to be |
| 41 | "needed" in the submit records for a change, with respect |
| 42 | to this queue. In other words, the list of review labels |
| 43 | this reporter itself is likely to set before submitting. |
| 44 | """ |
| 45 | return [] |
Joshua Hesketh | 352264b | 2015-08-11 23:42:08 +1000 | [diff] [blame^] | 46 | |
| 47 | def postConfig(self): |
| 48 | """Run tasks after configuration is reloaded""" |