Format code

This commit is contained in:
taizan-hokuto
2020-06-04 23:10:26 +09:00
parent e6dbc8772e
commit 2474207691
50 changed files with 635 additions and 622 deletions

View File

@@ -1,5 +1,7 @@
import asyncio
class Buffer(asyncio.Queue):
'''
チャットデータを格納するバッファの役割を持つFIFOキュー
@@ -10,19 +12,20 @@ class Buffer(asyncio.Queue):
格納するチャットブロックの最大個数。0の場合は無限。
最大値を超える場合は古いチャットブロックから破棄される。
'''
def __init__(self,maxsize = 0):
def __init__(self, maxsize=0):
super().__init__(maxsize)
async def put(self,item):
async def put(self, item):
if item is None:
return
return
if super().full():
super().get_nowait()
await super().put(item)
def put_nowait(self,item):
def put_nowait(self, item):
if item is None:
return
return
if super().full():
super().get_nowait()
super().put_nowait(item)
@@ -32,4 +35,4 @@ class Buffer(asyncio.Queue):
ret.append(await super().get())
while not super().empty():
ret.append(super().get_nowait())
return ret
return ret