@@ -185,7 +185,7 @@ def find_outgoing_by_content(self, content: str) -> MessageLog | None:
185185 MessageLog .direction == PennyConstants .MessageDirection .OUTGOING ,
186186 MessageLog .content .startswith (content ),
187187 )
188- .order_by (MessageLog .timestamp .desc ()) # type: ignore[unresolved-attribute]
188+ .order_by (MessageLog .timestamp .desc ())
189189 ).first ()
190190
191191 # --- Thread context ---
@@ -234,9 +234,7 @@ def _walk_thread(self, message_id: int, limit: int = 20) -> list[MessageLog]:
234234 def get_conversation_leaves (self ) -> list [MessageLog ]:
235235 """Get outgoing leaf messages eligible for spontaneous continuation."""
236236 with self ._session () as session :
237- has_child = select (MessageLog .parent_id ).where (
238- MessageLog .parent_id .isnot (None ) # type: ignore[unresolved-attribute]
239- )
237+ has_child = select (MessageLog .parent_id ).where (MessageLog .parent_id .isnot (None ))
240238 incoming_ids = select (MessageLog .id ).where (
241239 MessageLog .direction == PennyConstants .MessageDirection .INCOMING
242240 )
@@ -245,10 +243,10 @@ def get_conversation_leaves(self) -> list[MessageLog]:
245243 select (MessageLog )
246244 .where (
247245 MessageLog .direction == PennyConstants .MessageDirection .OUTGOING ,
248- MessageLog .id .notin_ (has_child ), # type: ignore[unresolved-attribute]
249- MessageLog .parent_id .in_ (incoming_ids ), # type: ignore[unresolved-attribute]
246+ MessageLog .id .notin_ (has_child ),
247+ MessageLog .parent_id .in_ (incoming_ids ),
250248 )
251- .order_by (MessageLog .timestamp .desc ()) # type: ignore[unresolved-attribute]
249+ .order_by (MessageLog .timestamp .desc ())
252250 ).all ()
253251 )
254252
@@ -262,7 +260,7 @@ def get_user_messages(self, sender: str, limit: int = 100) -> list[MessageLog]:
262260 MessageLog .sender == sender ,
263261 MessageLog .direction == PennyConstants .MessageDirection .INCOMING ,
264262 )
265- .order_by (MessageLog .timestamp .desc ()) # type: ignore[unresolved-attribute]
263+ .order_by (MessageLog .timestamp .desc ())
266264 .limit (limit )
267265 ).all ()
268266 )
@@ -289,7 +287,7 @@ def _get_recent_incoming(self, session: Any, sender: str, limit: int) -> list[Me
289287 MessageLog .direction == PennyConstants .MessageDirection .INCOMING ,
290288 MessageLog .is_reaction == False , # noqa: E712
291289 )
292- .order_by (MessageLog .timestamp .desc ()) # type: ignore[unresolved-attribute]
290+ .order_by (MessageLog .timestamp .desc ())
293291 .limit (limit )
294292 ).all ()
295293 )
@@ -303,7 +301,7 @@ def _get_threaded_replies(self, session: Any, incoming: list[MessageLog]) -> lis
303301 session .exec (
304302 select (MessageLog ).where (
305303 MessageLog .direction == PennyConstants .MessageDirection .OUTGOING ,
306- MessageLog .parent_id .in_ (incoming_ids ), # type: ignore[unresolved-attribute]
304+ MessageLog .parent_id .in_ (incoming_ids ),
307305 )
308306 ).all ()
309307 )
@@ -320,7 +318,7 @@ def _get_autonomous_outgoing(
320318 MessageLog .parent_id == None , # noqa: E711
321319 MessageLog .recipient == recipient ,
322320 )
323- .order_by (MessageLog .timestamp .desc ()) # type: ignore[unresolved-attribute]
321+ .order_by (MessageLog .timestamp .desc ())
324322 .limit (limit )
325323 ).all ()
326324 )
@@ -345,7 +343,7 @@ def get_messages_in_range(
345343 MessageLog .timestamp >= start ,
346344 MessageLog .timestamp < end ,
347345 )
348- .order_by (MessageLog .timestamp ) # type : ignore[unresolved-attribute ]
346+ .order_by (MessageLog .timestamp ) # ty : ignore[invalid-argument-type ]
349347 ).all ()
350348 )
351349
@@ -364,7 +362,7 @@ def get_reactions_in_range(
364362 MessageLog .timestamp >= start ,
365363 MessageLog .timestamp < end ,
366364 )
367- .order_by (MessageLog .timestamp ) # type : ignore[unresolved-attribute ]
365+ .order_by (MessageLog .timestamp ) # ty : ignore[invalid-argument-type ]
368366 ).all ()
369367 )
370368
@@ -382,7 +380,7 @@ def get_messages_since(
382380 MessageLog .is_reaction == False , # noqa: E712
383381 MessageLog .timestamp >= since ,
384382 )
385- .order_by (MessageLog .timestamp .desc ()) # type: ignore[unresolved-attribute]
383+ .order_by (MessageLog .timestamp .desc ())
386384 .limit (limit )
387385 ).all ()
388386 )
@@ -396,7 +394,7 @@ def get_messages_since(
396394 MessageLog .recipient == sender ,
397395 MessageLog .timestamp >= since ,
398396 )
399- .order_by (MessageLog .timestamp .desc ()) # type: ignore[unresolved-attribute]
397+ .order_by (MessageLog .timestamp .desc ())
400398 .limit (limit )
401399 ).all ()
402400 )
@@ -416,7 +414,7 @@ def get_unprocessed(self, sender: str, limit: int) -> list[MessageLog]:
416414 MessageLog .is_reaction == False , # noqa: E712
417415 MessageLog .processed == False , # noqa: E712
418416 )
419- .order_by (MessageLog .timestamp .desc ()) # type: ignore[unresolved-attribute]
417+ .order_by (MessageLog .timestamp .desc ())
420418 .limit (limit )
421419 ).all ()
422420 )
@@ -433,7 +431,7 @@ def get_user_reactions(self, sender: str, limit: int) -> list[MessageLog]:
433431 MessageLog .is_reaction == True , # noqa: E712
434432 MessageLog .processed == False , # noqa: E712
435433 )
436- .order_by (MessageLog .timestamp .desc ()) # type: ignore[unresolved-attribute]
434+ .order_by (MessageLog .timestamp .desc ())
437435 .limit (limit )
438436 ).all ()
439437 )
@@ -468,11 +466,9 @@ def count_active_threads(self) -> int:
468466 with self ._session () as session :
469467 from sqlalchemy import func
470468
471- has_child = select (MessageLog .parent_id ).where (
472- MessageLog .parent_id .isnot (None ) # type: ignore[unresolved-attribute]
473- )
469+ has_child = select (MessageLog .parent_id ).where (MessageLog .parent_id .isnot (None ))
474470 return session .exec (
475- select (func .count ()).select_from (MessageLog ).where (MessageLog .id .notin_ (has_child )) # type: ignore[unresolved-attribute]
471+ select (func .count ()).select_from (MessageLog ).where (MessageLog .id .notin_ (has_child ))
476472 ).one ()
477473
478474 def get_latest_incoming_time (self , sender : str ) -> datetime | None :
@@ -485,7 +481,7 @@ def get_latest_incoming_time(self, sender: str) -> datetime | None:
485481 MessageLog .direction == PennyConstants .MessageDirection .INCOMING ,
486482 MessageLog .is_reaction == False , # noqa: E712
487483 )
488- .order_by (MessageLog .timestamp .desc ()) # type: ignore[unresolved-attribute]
484+ .order_by (MessageLog .timestamp .desc ())
489485 .limit (1 )
490486 ).first ()
491487
@@ -499,7 +495,7 @@ def get_latest_autonomous_outgoing_time(self, recipient: str) -> datetime | None
499495 MessageLog .parent_id == None , # noqa: E711
500496 MessageLog .recipient == recipient ,
501497 )
502- .order_by (MessageLog .timestamp .desc ()) # type: ignore[unresolved-attribute]
498+ .order_by (MessageLog .timestamp .desc ())
503499 .limit (1 )
504500 ).first ()
505501
@@ -533,10 +529,10 @@ def get_last_checkin_time(self, prompt_text: str, hours: int = 48) -> datetime |
533529 return session .exec (
534530 select (PromptLog .timestamp )
535531 .where (
536- PromptLog .messages .contains (prompt_text ), # type: ignore[unresolved-attribute]
532+ PromptLog .messages .contains (prompt_text ),
537533 PromptLog .timestamp >= cutoff ,
538534 )
539- .order_by (PromptLog .timestamp .desc ()) # type: ignore[unresolved-attribute]
535+ .order_by (PromptLog .timestamp .desc ())
540536 .limit (1 )
541537 ).first ()
542538
@@ -553,7 +549,7 @@ def get_recent_outgoing_content(
553549 MessageLog .recipient == recipient ,
554550 MessageLog .timestamp >= cutoff ,
555551 )
556- .order_by (MessageLog .timestamp .desc ()) # type: ignore[unresolved-attribute]
552+ .order_by (MessageLog .timestamp .desc ())
557553 .limit (limit )
558554 ).all ()
559555 return [m for m in messages if m ]
@@ -577,7 +573,7 @@ def get_latest_message_time_in_range(
577573 MessageLog .timestamp >= start ,
578574 MessageLog .timestamp < end ,
579575 )
580- .order_by (MessageLog .timestamp .desc ()) # type: ignore[unresolved-attribute]
576+ .order_by (MessageLog .timestamp .desc ())
581577 .limit (1 )
582578 ).first ()
583579
@@ -591,6 +587,6 @@ def get_first_message_time(self, sender: str) -> datetime | None:
591587 MessageLog .direction == PennyConstants .MessageDirection .INCOMING ,
592588 MessageLog .is_reaction == False , # noqa: E712
593589 )
594- .order_by (MessageLog .timestamp ) # type : ignore[unresolved-attribute ]
590+ .order_by (MessageLog .timestamp ) # ty : ignore[invalid-argument-type ]
595591 .limit (1 )
596592 ).first ()
0 commit comments