Skip to content

Commit

Permalink
fix typing in server
Browse files Browse the repository at this point in the history
  • Loading branch information
themanyfaceddemon committed Aug 11, 2024
1 parent 5b5342b commit 0ffa727
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions DMBotNetwork/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ def __init__(self, host: str, port: int, db_path: Path, owner_password: str = 'o
self._port: int = port
self._is_online: bool = False

self._connection = None

self._server = None
self._connection: Optional[aiosqlite.Connection] = None
self._server: Optional[asyncio.AbstractServer] = None

self._db_path: Path = db_path
self._owner_password: str = owner_password
Expand Down Expand Up @@ -54,7 +53,7 @@ async def _init_db(self, db_path: Path, owner_password: str) -> None:
)
await self._connection.commit()

async def _check_password(self, password: str, db_password: bytes):
async def _check_password(self, password: str, db_password: bytes) -> bool:
loop = asyncio.get_running_loop()
return await loop.run_in_executor(None, bcrypt.checkpw, password.encode(), db_password)

Expand Down Expand Up @@ -156,7 +155,7 @@ async def db_change_access(self, username: str, new_access: Optional[Dict[str, b
logging.error(f"Error changing access for user {username}: {e}")

# Client work
async def _req_auth(self, reader: StreamReader, writer: StreamWriter) -> str:
async def _req_auth(self, reader: StreamReader, writer: StreamWriter) -> Optional[str]:
try:
await self.send_data(writer, {"action": "auth"})
user_data = await asyncio.wait_for(self.receive_data(reader), timeout=self.TIME_OUT)
Expand Down

0 comments on commit 0ffa727

Please sign in to comment.