equal
deleted
inserted
replaced
1 """ |
|
2 Our list of LogChannels |
|
3 """ |
|
4 |
|
5 class ChannelList (object) : |
|
6 """ |
|
7 The list of channels, and related methods |
|
8 """ |
|
9 |
|
10 |
|
11 def __init__ (self, channel_list) : |
|
12 """ |
|
13 Initialize with the given channel dict |
|
14 """ |
|
15 |
|
16 self.channel_list = channel_list |
|
17 self.channel_dict = dict((channel.id, channel) for channel in channel_list) |
|
18 |
|
19 def lookup (self, channel_name) : |
|
20 """ |
|
21 Looks up the LogChannel for the given name |
|
22 """ |
|
23 |
|
24 return self.channel_dict[channel_name] |
|
25 |
|
26 def dict (self) : |
|
27 """ |
|
28 Returns a { name: LogChannel } dict |
|
29 """ |
|
30 return self.channel_dict |
|
31 |
|
32 def __iter__ (self) : |
|
33 """ |
|
34 Iterate over our defined LogChannel objects |
|
35 """ |
|
36 |
|
37 return iter(self.channel_list) |
|
38 |
|