Skip to content

Commit ad45cf6

Browse files
jhrozekblkt
authored andcommitted
Assorted small fixes in the replace-litellm branch (#1082)
* Make condition more pythonic * Silence warning in the copilot provider * Remove unused variable
1 parent e3aefe3 commit ad45cf6

File tree

3 files changed

+2
-10
lines changed

3 files changed

+2
-10
lines changed

Diff for: src/codegate/pipeline/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def get_last_user_message_block(
231231
user_messages.append(txt)
232232
last_idx = idx
233233

234-
if user_messages == []:
234+
if not user_messages:
235235
return None
236236
return "\n".join(reversed(user_messages)), last_idx
237237

Diff for: src/codegate/pipeline/codegate_context_retriever/codegate.py

-3
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,6 @@ async def process( # noqa: C901
132132

133133
logger.info(f"Adding {len(all_bad_packages)} bad packages to the context.")
134134

135-
# Generate context string using the searched objects
136-
context_str = "CodeGate did not find any malicious or archived packages."
137-
138135
# Nothing to do if no bad packages are found
139136
if len(all_bad_packages) == 0:
140137
return PipelineResult(request=request, context=context)

Diff for: src/codegate/providers/copilot/provider.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@
2424
CopilotPipeline,
2525
)
2626
from codegate.providers.copilot.streaming import SSEProcessor
27-
from codegate.types.common import (
28-
Delta,
29-
ModelResponse,
30-
StreamingChoices,
31-
)
3227
from codegate.types.openai import StreamingChatCompletion
3328

3429
setup_logging()
@@ -236,7 +231,7 @@ async def _body_through_pipeline(
236231
path: str,
237232
headers: list[str],
238233
body: bytes,
239-
) -> Tuple[bytes, PipelineContext]:
234+
) -> Tuple[bytes, PipelineContext | None]:
240235
strategy = self._select_pipeline(method, path)
241236
if len(body) == 0 or strategy is None:
242237
# if we didn't select any strategy that would change the request

0 commit comments

Comments
 (0)