aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar jesopo2018-11-11 16:11:45 +0000
committerGravatar jesopo2018-11-11 16:11:45 +0000
commitdb1e2ea40650d2280ed70bc86cd0622fc596c8de (patch)
tree3e73655f6f056bbc1b6fa9afce5cc47676a38574 /src
parentSplit out Channels in to IRCChannels.Channels, not IRCChannel.Channels (diff)
signature
Add missing imports and `Channel` namespacing to src/IRCChannel.py
Diffstat (limited to 'src')
-rw-r--r--src/IRCChannels.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/IRCChannels.py b/src/IRCChannels.py
index 8038788a..721afebb 100644
--- a/src/IRCChannels.py
+++ b/src/IRCChannels.py
@@ -1,4 +1,5 @@
-from src import EventManager, IRCBot, IRCChannel, IRCServer
+import typing
+from src import EventManager, IRCBot, IRCChannel, IRCServer, utils
class Channels(object):
def __init__(self, server: "IRCServer.Server", bot: "IRCBot.Bot",
@@ -6,9 +7,9 @@ class Channels(object):
self._server = server
self._bot = bot
self._events = events
- self._channels = {} # type: typing.Dict[str, Channel]
+ self._channels = {} # type: typing.Dict[str, IRCChannel.Channel]
- def __iter__(self) -> typing.Iterable[Channel]:
+ def __iter__(self) -> typing.Iterable[IRCChannel.Channel]:
return (channel for channel in self._channels.values())
def __contains__(self, name: str) -> bool:
return self.contains(name)
@@ -28,15 +29,15 @@ class Channels(object):
lower = self._name_lower(name)
return name[0] in self._server.channel_types and lower in self._channels
- def add(self, name: str) -> Channel:
+ def add(self, name: str) -> IRCChannel.Channel:
id = self._get_id(name)
lower = self._name_lower(name)
- new_channel = Channel(lower, id, self._server, self._bot)
+ new_channel = IRCChannel.Channel(lower, id, self._server, self._bot)
self._channels[lower] = new_channel
self._events.on("new.channel").call(channel=new_channel, server=self)
return new_channel
- def remove(self, channel: Channel):
+ def remove(self, channel: IRCChannel.Channel):
lower = self._name_lower(channel.name)
del self._channels[lower]