Skip to content

Commit

Permalink
fix: fixed up ruff errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanleomk committed Oct 29, 2024
1 parent 7a90dc9 commit e84332c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions docs/hooks/hide_lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

@mkdocs.plugins.event_priority(0)
# pylint: disable=unused-argument
def on_startup(command: str, dirty: bool) -> None:
def on_startup(command: str, dirty: bool) -> None: # noqa: ARG001
"""Monkey patch Highlight extension to hide lines in code blocks."""
original = highlight.Highlight.highlight
original = highlight.Highlight.highlight # type: ignore

def patched(self: Any, src: str, *args: Any, **kwargs: Any) -> Any:
lines = src.splitlines(keepends=True)
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/7-synthetic-data-generation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@
"\n",
"for metric,size in product(METRICS,SIZES):\n",
" metric_name, score_fn = metric\n",
" score_fns[f\"{metric_name}@{size}\"] = lambda predictions,labels : score_fn(predictions[:size],labels)"
" score_fns[f\"{metric_name}@{size}\"] = lambda predictions,labels, fn=score_fn, k=size: fn(predictions[:k],labels) # type: ignore"
]
},
{
Expand Down
14 changes: 7 additions & 7 deletions make_desc.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
from typing import Optional, List, Set, Literal
from typing import Optional, Literal
import asyncio
from openai import AsyncOpenAI
import typer
Expand All @@ -15,7 +15,7 @@


async def generate_ai_frontmatter(
client: AsyncOpenAI, title: str, content: str, categories: List[str]
client: AsyncOpenAI, title: str, content: str, categories: list[str]
):
"""
Generate a description and categories for the given content using AI.
Expand All @@ -35,8 +35,8 @@ class DescriptionAndCategories(BaseModel):
reasoning: str = Field(
..., description="The reasoning for the correct categories"
)
tags: List[str]
categories: List[
tags: list[str]
categories: list[
Literal[
"OpenAI",
"Anthropic",
Expand Down Expand Up @@ -72,7 +72,7 @@ class DescriptionAndCategories(BaseModel):
return response


def get_all_categories(root_dir: str) -> Set[str]:
def get_all_categories(root_dir: str) -> set[str]:
"""
Read all markdown files and extract unique categories.
Expand Down Expand Up @@ -113,7 +113,7 @@ def preview_categories(root_dir: str) -> None:


async def process_file(
client: AsyncOpenAI, file_path: str, categories: List[str], enable_comments: bool
client: AsyncOpenAI, file_path: str, categories: list[str], enable_comments: bool
) -> None:
"""
Process a single file, adding or updating the description and categories in the front matter.
Expand Down Expand Up @@ -143,7 +143,7 @@ async def process_file(

async def process_files(
root_dir: str,
api_key: Optional[str] = None,
api_key: Optional[str] = None, # noqa: ARG001
use_categories: bool = False,
enable_comments: bool = False,
) -> None:
Expand Down
1 change: 0 additions & 1 deletion tests/llm/test_anthropic/conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# conftest.py
from anthropic import AsyncAnthropic, Anthropic
import pytest
import os

try:
import braintrust
Expand Down

0 comments on commit e84332c

Please sign in to comment.