Skip to content

Commit 0fc4746

Browse files
author
Your Name
committed
Pre-commit updates
1 parent a197b08 commit 0fc4746

8 files changed

Lines changed: 29 additions & 24 deletions

File tree

benchmark/benchmark.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,7 @@ def simple_namespace_to_dict(obj):
292292

293293
if not dry and "CECLI_DOCKER" not in os.environ:
294294
logger.warning("Warning: Benchmarking runs unvetted code. Run in a docker container.")
295-
logger.warning(
296-
"Set CECLI_DOCKER in the environment to by-pass this check at your own risk."
297-
)
295+
logger.warning("Set CECLI_DOCKER in the environment to bypass this check at your own risk.")
298296
return
299297

300298
# Check dirs exist

cecli/coders/base_coder.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,8 +1131,9 @@ def _include_in_map(abs_path):
11311131
"other_files": other_files,
11321132
"mentioned_fnames": mentioned_fnames,
11331133
"all_abs_files": all_abs_files,
1134-
"read_only_count": len(set(self.abs_read_only_fnames)) + len(
1135-
set(self.abs_read_only_stubs_fnames)
1134+
"read_only_count": (
1135+
len(set(self.abs_read_only_fnames))
1136+
+ len(set(self.abs_read_only_stubs_fnames))
11361137
),
11371138
}
11381139
)

cecli/onboarding.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def start_openrouter_oauth_flow(io):
165165

166166
class OAuthCallbackHandler(http.server.SimpleHTTPRequestHandler):
167167
def do_GET(self):
168-
nonlocal auth_code, server_error
168+
nonlocal auth_code, server_error # noqa
169169
parsed_path = urlparse(self.path)
170170
if parsed_path.path == "/callback/cecli":
171171
query_params = parse_qs(parsed_path.query)
@@ -193,7 +193,7 @@ def log_message(self, format, *args):
193193
pass
194194

195195
def run_server():
196-
nonlocal server_error
196+
nonlocal server_error # noqa
197197
try:
198198
with socketserver.TCPServer(("localhost", port), OAuthCallbackHandler) as httpd:
199199
io.tool_output(f"Temporary server listening on {callback_url}", log_only=True)
@@ -203,7 +203,7 @@ def run_server():
203203
time.sleep(0.1)
204204
io.tool_output("Shutting down temporary server.", log_only=True)
205205
except Exception as e:
206-
server_error = f"Failed to start or run temporary server: {e}"
206+
server_error = f"Failed to start or run temporary server: {e}" # noqa
207207
server_started.set()
208208
shutdown_server.set()
209209

cecli/report.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,22 +78,22 @@ def format_args_for_reporting(args):
7878

7979

8080
def get_args_error_data():
81-
global resolved_args_data
81+
global resolved_args_data # noqa
8282
return resolved_args_data
8383

8484

8585
def set_args_error_data(args):
86-
global resolved_args_data
86+
global resolved_args_data # noqa
8787
resolved_args_data = args
8888

8989

9090
def get_error_prefix():
91-
global error_prefix
91+
global error_prefix # noqa
9292
return error_prefix
9393

9494

9595
def update_error_prefix(prefix):
96-
global error_prefix
96+
global error_prefix # noqa
9797
error_prefix.append(f"{prefix}\n")
9898
error_prefix = error_prefix[-10:]
9999

cecli/sessions.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,10 @@ def list_sessions(self) -> List[Dict]:
7171
"file": session_file,
7272
"model": session_data.get("model", "unknown"),
7373
"edit_format": session_data.get("edit_format", "unknown"),
74-
"num_messages": len(
75-
session_data.get("chat_history", {}).get("done_messages", [])
76-
) + len(session_data.get("chat_history", {}).get("cur_messages", [])),
74+
"num_messages": (
75+
len(session_data.get("chat_history", {}).get("done_messages", []))
76+
+ len(session_data.get("chat_history", {}).get("cur_messages", []))
77+
),
7778
"num_files": (
7879
len(session_data.get("files", {}).get("editable", []))
7980
+ len(session_data.get("files", {}).get("read_only", []))
@@ -149,11 +150,11 @@ def _build_session_data(self, session_name) -> Dict:
149150
"editor_edit_format": self.coder.main_model.editor_edit_format,
150151
"edit_format": self.coder.edit_format,
151152
"chat_history": {
152-
"done_messages": ConversationService.get_manager(self.coder).get_messages_dict(
153-
MessageTag.DONE
153+
"done_messages": (
154+
ConversationService.get_manager(self.coder).get_messages_dict(MessageTag.DONE)
154155
),
155-
"cur_messages": ConversationService.get_manager(self.coder).get_messages_dict(
156-
MessageTag.CUR
156+
"cur_messages": (
157+
ConversationService.get_manager(self.coder).get_messages_dict(MessageTag.CUR)
157158
),
158159
},
159160
"files": {

scripts/30k-image.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,18 @@ def generate_celebration_svg(output_path=None, width=DEFAULT_WIDTH, height=DEFAU
135135

136136
# Font embedding
137137
font_data = embed_font()
138-
font_face = f"""
138+
font_face = (
139+
f"""
139140
@font-face {{
140141
font-family: 'GlassTTYVT220';
141142
src: url(data:font/truetype;charset=utf-8;base64,{font_data}) format('truetype');
142143
font-weight: normal;
143144
font-style: normal;
144145
}}
145-
""" if font_data else ""
146+
"""
147+
if font_data
148+
else ""
149+
)
146150

147151
# Generate confetti elements
148152
confetti = generate_confetti(count=150, width=width, height=height)

tests/basic/test_sessions.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,10 @@ async def test_cmd_load_session_basic(self):
106106
"read_only_stubs": [],
107107
},
108108
"settings": {"auto_commits": True, "auto_lint": False, "auto_test": False},
109-
"todo_list": """Restored tasks
110-
- item""",
109+
"todo_list": (
110+
"""Restored tasks
111+
- item"""
112+
),
111113
}
112114
session_file = Path(handle_core_files(".cecli")) / "sessions" / "test_session.json"
113115
session_file.parent.mkdir(parents=True, exist_ok=True)

tests/hooks/test_base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Tests for base hook classes."""
22

3-
43
import pytest
54

65
from cecli.hooks import BaseHook, CommandHook, HookType

0 commit comments

Comments
 (0)