Skip to content

Commit

Permalink
Adds ruff linting and formatting (#262)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggaabe committed Dec 8, 2023
1 parent 6ac25db commit 9b7fbbb
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 4 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: Ruff
on: [push, pull_request]
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: chartboost/ruff-action@v1
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.7
hooks:
# Run the linter.
- id: ruff
args: [ --fix ]
# Run the formatter.
- id: ruff-format
2 changes: 1 addition & 1 deletion examples/task_planner/task_planner_topological_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def _get_execution_order(self) -> List[int]:
tmp_dep_graph = {item.id: set(item.subtasks) for item in self.task_graph}

def topological_sort(
dep_graph: dict[int, set[int]]
dep_graph: dict[int, set[int]],
) -> Generator[set[int], None, None]:
while True:
ordered = set(item for item, dep in dep_graph.items() if len(dep) == 0)
Expand Down
2 changes: 1 addition & 1 deletion instructor/cli/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def delete(file_id: str = typer.Argument(..., help="ID of the file to delete")):
help="Monitor the status of a file on OpenAI's servers",
)
def status(
file_id: str = typer.Argument(..., help="ID of the file to check the status of")
file_id: str = typer.Argument(..., help="ID of the file to check the status of"),
):
with console.status(f"Monitoring status of file {file_id}...") as status:
while True:
Expand Down
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ openai>=1.1.0
pydantic
docstring-parser
rich
aiohttp
aiohttp
ruff==0.1.7
pre-commit==3.5.0
1 change: 0 additions & 1 deletion tests/openai/evals/test_nested_structures.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from typing import Iterable
from openai import OpenAI
from pydantic import BaseModel, Field
from typing import List
Expand Down

0 comments on commit 9b7fbbb

Please sign in to comment.