diff options
Diffstat (limited to 'distbuild/mainloop.py')
-rw-r--r-- | distbuild/mainloop.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/distbuild/mainloop.py b/distbuild/mainloop.py index 97e439f3..e7c0cc3b 100644 --- a/distbuild/mainloop.py +++ b/distbuild/mainloop.py @@ -12,8 +12,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.. +# with this program. If not, see <http://www.gnu.org/licenses/>. import fcntl @@ -57,8 +56,11 @@ class MainLoop(object): logging.debug('MainLoop.remove_state_machine: %s' % machine) self._machines.remove(machine) + def state_machines_of_type(self, machine_type): + return [m for m in self._machines if isinstance(m, machine_type)] + def n_state_machines_of_type(self, machine_type): - return len([m for m in self._machines if isinstance(m, machine_type)]) + return len(self.state_machines_of_type(machine_type)) def add_event_source(self, event_source): logging.debug('MainLoop.add_event_source: %s' % event_source) |