update ircstates, now only one (maybe Optional) Emit

This commit is contained in:
jesopo 2020-04-22 18:05:23 +01:00
parent 739b039d50
commit d51fcf0987
3 changed files with 9 additions and 9 deletions

View file

@ -98,7 +98,7 @@ class IServer(Server):
async def sts_policy(self, sts: STSPolicy):
pass
async def next_line(self) -> Optional[Tuple[Line, List[Emit]]]:
async def next_line(self) -> Optional[Tuple[Line, Optional[Emit]]]:
pass
def cap_agreed(self, capability: ICapability) -> bool:

View file

@ -44,7 +44,7 @@ class Server(IServer):
self._write_queue: PriorityQueue[SentLine] = PriorityQueue()
self.desired_caps: Set[ICapability] = set([])
self._read_queue: Deque[Tuple[Line, List[Emit]]] = deque()
self._read_queue: Deque[Tuple[Line, Optional[Emit]]] = deque()
def hostmask(self) -> str:
hostmask = self.nickname
@ -149,7 +149,7 @@ class Server(IServer):
if line.command == "PING":
await self.send(build("PONG", line.params))
async def next_line(self) -> Tuple[Line, List[Emit]]:
async def next_line(self) -> Tuple[Line, Optional[Emit]]:
if self._read_queue:
both = self._read_queue.popleft()
else:
@ -166,8 +166,8 @@ class Server(IServer):
both = lines[0]
break
line, emits = both
for emit in emits:
line, emit = both
if emit is not None:
await self._on_read_emit(line, emit)
await self._on_read_line(line)
await self.line_read(line)
@ -179,7 +179,7 @@ class Server(IServer):
self._wait_for.append((our_fut, response))
while self._wait_for:
both = await self.next_line()
line, emits = both
line, emit = both
for i, (fut, waiting) in enumerate(self._wait_for):
if waiting.match(self, line):
@ -193,8 +193,8 @@ class Server(IServer):
if (line.command == "PRIVMSG" and
not self.cap_agreed(CAP_ECHO)):
new_line = line.with_source(self.hostmask())
emits = self.parse_tokens(new_line)
self._read_queue.append((new_line, emits))
emit = self.parse_tokens(new_line)
self._read_queue.append((new_line, emit))
async def _write_lines(self) -> List[Line]:
lines: List[SentLine] = []

View file

@ -1,5 +1,5 @@
anyio ==1.3.0
asyncio-throttle ==1.0.1
dataclasses ==0.6
ircstates ==0.9.4
ircstates ==0.9.5
async_stagger ==0.3.0