1212from api .error_codes import ErrorCode , error_response
1313from models .export import ExportStateDict
1414from utils .exclusion_rules import is_session_excluded
15- from utils .export_engine import EXPORT_ERRORS as _EXPORT_ERRORS
16- from utils .export_engine import ZipSink , run_bulk_export
15+ from utils .export_engine import EXPORT_ERRORS as _EXPORT_ERRORS , ZipSink , run_bulk_export
1716from utils .export_state_store import (
1817 EXPORT_STATE_FILE ,
1918 atomic_write_export_state ,
@@ -94,10 +93,7 @@ def bulk_export() -> FlaskReturn:
9493 since = since ,
9594 )
9695
97- base = (
98- current_app .config .get ("CLAUDE_PROJECTS_DIR" )
99- or get_claude_projects_dir ()
100- )
96+ base = current_app .config .get ("CLAUDE_PROJECTS_DIR" ) or get_claude_projects_dir ()
10197 projects = list_projects (base )
10298 rules = current_app .config .get ("EXCLUSION_RULES" ) or []
10399
@@ -109,9 +105,7 @@ def bulk_export() -> FlaskReturn:
109105 buf = io .BytesIO ()
110106
111107 def _on_export_error (sid : str , exc : Exception ) -> None :
112- current_app .logger .warning (
113- "Failed to export %s: %s" , sid [:10 ], exc
114- )
108+ current_app .logger .warning ("Failed to export %s: %s" , sid [:10 ], exc )
115109
116110 with zipfile .ZipFile (buf , "w" , zipfile .ZIP_DEFLATED ) as zf :
117111 result = run_bulk_export (
@@ -163,10 +157,7 @@ def _on_export_error(sid: str, exc: Exception) -> None:
163157def export_session (project_name : str , session_id : str ) -> FlaskReturn :
164158 from utils .session_path import safe_join
165159
166- base = (
167- current_app .config .get ("CLAUDE_PROJECTS_DIR" )
168- or get_claude_projects_dir ()
169- )
160+ base = current_app .config .get ("CLAUDE_PROJECTS_DIR" ) or get_claude_projects_dir ()
170161 try :
171162 filepath = safe_join (base , project_name , f"{ session_id } .jsonl" )
172163 except ValueError :
@@ -183,9 +174,7 @@ def export_session(project_name: str, session_id: str) -> FlaskReturn:
183174 try :
184175 session = parse_session (filepath )
185176 except _EXPORT_ERRORS :
186- current_app .logger .exception (
187- "Failed to parse session %s for export" , session_id
188- )
177+ current_app .logger .exception ("Failed to parse session %s for export" , session_id )
189178 return error_response (
190179 ErrorCode .PARSE_ERROR ,
191180 "Failed to parse session" ,
@@ -203,9 +192,7 @@ def export_session(project_name: str, session_id: str) -> FlaskReturn:
203192 try :
204193 stats = compute_stats (session )
205194 except _EXPORT_ERRORS :
206- current_app .logger .exception (
207- "Failed to compute stats for export %s" , session_id
208- )
195+ current_app .logger .exception ("Failed to compute stats for export %s" , session_id )
209196 return error_response (
210197 ErrorCode .INTERNAL_ERROR ,
211198 "Failed to compute session stats" ,
0 commit comments