refactor: add type hints to function signatures across multiple files

This commit is contained in:
grillazz
2026-07-13 14:25:49 +02:00
parent 51f0cebabe
commit eb8acd7b7c
10 changed files with 27 additions and 15 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ class Stuff(Base):
@classmethod
@compile_sql_or_scalar
async def get_by_name(cls, db_session: AsyncSession, name: str, compile_sql=False):
async def get_by_name(cls, db_session: AsyncSession, name: str, compile_sql: bool=False):
stmt = select(cls).options(joinedload(cls.nonsense)).where(cls.name == name)
return stmt
+3 -3
View File
@@ -21,15 +21,15 @@ class User(Base):
_password: bytes = Column(LargeBinary, nullable=False)
@property
def password(self):
def password(self) -> str:
return self._password.decode("utf-8")
@password.setter
def password(self, password: SecretStr):
def password(self, password: SecretStr) -> None:
_password_string = password.get_secret_value().encode("utf-8")
self._password = bcrypt.hashpw(_password_string, bcrypt.gensalt())
def check_password(self, password: SecretStr):
def check_password(self, password: SecretStr) -> bool:
return bcrypt.checkpw(
password.get_secret_value().encode("utf-8"), self._password
)