@@ -79,8 +79,14 @@ def create_checkpoint(
7979 ) -> ReviewCheckpoint :
8080 checkpoint = ReviewCheckpoint (workflow_id , step , data , expires_minutes )
8181 self ._checkpoints [checkpoint .checkpoint_id ] = checkpoint
82- self ._workflow_index .setdefault (workflow_id , []).append (checkpoint .checkpoint_id )
83- log .info ("Created review checkpoint %s for workflow %s" , checkpoint .checkpoint_id , workflow_id )
82+ self ._workflow_index .setdefault (workflow_id , []).append (
83+ checkpoint .checkpoint_id
84+ )
85+ log .info (
86+ "Created review checkpoint %s for workflow %s" ,
87+ checkpoint .checkpoint_id ,
88+ workflow_id ,
89+ )
8490 return checkpoint
8591
8692 def _raw_workflow_checkpoints (self , workflow_id : str ) -> List [ReviewCheckpoint ]:
@@ -95,7 +101,9 @@ def _enforce_expiry(self, workflow_id: str) -> None:
95101 cp .status = ReviewDecision .EXPIRED
96102 cp .comments = "Checkpoint expired before review."
97103 cp .reviewed_at = datetime .now (timezone .utc ).isoformat ()
98- log .warning ("Checkpoint %s expired and was auto-rejected." , cp .checkpoint_id )
104+ log .warning (
105+ "Checkpoint %s expired and was auto-rejected." , cp .checkpoint_id
106+ )
99107
100108 def get_checkpoint (self , checkpoint_id : str ) -> Optional [ReviewCheckpoint ]:
101109 cp = self ._checkpoints .get (checkpoint_id )
@@ -148,9 +156,15 @@ def any_rejected(self, workflow_id: str) -> bool:
148156
149157 def pending_checkpoints (self , workflow_id : str ) -> List [ReviewCheckpoint ]:
150158 self ._enforce_expiry (workflow_id )
151- return [c for c in self .get_workflow_checkpoints (workflow_id ) if c .status == ReviewDecision .PENDING ]
152-
153- def get_checkpoint_by_step (self , workflow_id : str , step : str ) -> Optional [ReviewCheckpoint ]:
159+ return [
160+ c
161+ for c in self .get_workflow_checkpoints (workflow_id )
162+ if c .status == ReviewDecision .PENDING
163+ ]
164+
165+ def get_checkpoint_by_step (
166+ self , workflow_id : str , step : str
167+ ) -> Optional [ReviewCheckpoint ]:
154168 for cp in self .get_workflow_checkpoints (workflow_id ):
155169 if cp .step == step :
156170 return cp
0 commit comments