Dixing Xu
commited on
:rotating_light: add linter workflow and fix issues
Browse files* Add github action for linter
* Fix current linter issues
- .github/workflows/linter.yml +21 -0
- aide/__init__.py +1 -4
- aide/agent.py +1 -1
- aide/backend/utils.py +3 -3
- aide/interpreter.py +1 -1
- aide/run.py +0 -2
.github/workflows/linter.yml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Linter
|
2 |
+
|
3 |
+
on:
|
4 |
+
- push
|
5 |
+
- pull_request
|
6 |
+
|
7 |
+
jobs:
|
8 |
+
lint-python:
|
9 |
+
name: ruff
|
10 |
+
runs-on: ubuntu-latest
|
11 |
+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
|
12 |
+
steps:
|
13 |
+
- name: Checkout Code
|
14 |
+
uses: actions/checkout@v4
|
15 |
+
- uses: actions/setup-python@v5
|
16 |
+
with:
|
17 |
+
python-version: 3.11
|
18 |
+
- name: Install Ruff
|
19 |
+
run: pip install ruff==0.7.1
|
20 |
+
- name: Run Ruff
|
21 |
+
run: ruff check --output-format=github aide/
|
aide/__init__.py
CHANGED
@@ -1,14 +1,11 @@
|
|
1 |
from dataclasses import dataclass
|
2 |
|
3 |
-
from .backend import compile_prompt_to_md
|
4 |
-
|
5 |
from .agent import Agent
|
6 |
from .interpreter import Interpreter
|
7 |
-
from .journal import Journal
|
8 |
from omegaconf import OmegaConf
|
9 |
from rich.status import Status
|
10 |
from .utils.config import load_task_desc, prep_agent_workspace, save_run, _load_cfg, prep_cfg
|
11 |
-
from pathlib import Path
|
12 |
|
13 |
@dataclass
|
14 |
class Solution:
|
|
|
1 |
from dataclasses import dataclass
|
2 |
|
|
|
|
|
3 |
from .agent import Agent
|
4 |
from .interpreter import Interpreter
|
5 |
+
from .journal import Journal
|
6 |
from omegaconf import OmegaConf
|
7 |
from rich.status import Status
|
8 |
from .utils.config import load_task_desc, prep_agent_workspace, save_run, _load_cfg, prep_cfg
|
|
|
9 |
|
10 |
@dataclass
|
11 |
class Solution:
|
aide/agent.py
CHANGED
@@ -3,7 +3,7 @@ import random
|
|
3 |
from typing import Any, Callable, cast
|
4 |
|
5 |
import humanize
|
6 |
-
from .backend import FunctionSpec,
|
7 |
from .interpreter import ExecutionResult
|
8 |
from .journal import Journal, Node
|
9 |
from .utils import data_preview
|
|
|
3 |
from typing import Any, Callable, cast
|
4 |
|
5 |
import humanize
|
6 |
+
from .backend import FunctionSpec, query
|
7 |
from .interpreter import ExecutionResult
|
8 |
from .journal import Journal, Node
|
9 |
from .utils import data_preview
|
aide/backend/utils.py
CHANGED
@@ -2,15 +2,15 @@ from dataclasses import dataclass
|
|
2 |
|
3 |
import jsonschema
|
4 |
from dataclasses_json import DataClassJsonMixin
|
|
|
|
|
|
|
5 |
|
6 |
PromptType = str | dict | list
|
7 |
FunctionCallType = dict
|
8 |
OutputType = str | FunctionCallType
|
9 |
|
10 |
|
11 |
-
import backoff
|
12 |
-
import logging
|
13 |
-
from typing import Callable
|
14 |
|
15 |
logger = logging.getLogger("aide")
|
16 |
|
|
|
2 |
|
3 |
import jsonschema
|
4 |
from dataclasses_json import DataClassJsonMixin
|
5 |
+
import backoff
|
6 |
+
import logging
|
7 |
+
from typing import Callable
|
8 |
|
9 |
PromptType = str | dict | list
|
10 |
FunctionCallType = dict
|
11 |
OutputType = str | FunctionCallType
|
12 |
|
13 |
|
|
|
|
|
|
|
14 |
|
15 |
logger = logging.getLogger("aide")
|
16 |
|
aide/interpreter.py
CHANGED
@@ -49,7 +49,7 @@ def exception_summary(e, working_dir, exec_file_name, format_tb_ipython):
|
|
49 |
tb_lines = traceback.format_exception(e)
|
50 |
# skip parts of stack trace in weflow code
|
51 |
tb_str = "".join(
|
52 |
-
[
|
53 |
)
|
54 |
# tb_str = "".join([l for l in tb_lines])
|
55 |
|
|
|
49 |
tb_lines = traceback.format_exception(e)
|
50 |
# skip parts of stack trace in weflow code
|
51 |
tb_str = "".join(
|
52 |
+
[line for line in tb_lines if "aide/" not in line and "importlib" not in line]
|
53 |
)
|
54 |
# tb_str = "".join([l for l in tb_lines])
|
55 |
|
aide/run.py
CHANGED
@@ -4,7 +4,6 @@ import shutil
|
|
4 |
|
5 |
from . import backend
|
6 |
|
7 |
-
from .utils import tree_export
|
8 |
from .agent import Agent
|
9 |
from .interpreter import Interpreter
|
10 |
from .journal import Journal, Node
|
@@ -23,7 +22,6 @@ from rich.progress import (
|
|
23 |
TimeRemainingColumn,
|
24 |
)
|
25 |
from rich.text import Text
|
26 |
-
from rich.markdown import Markdown
|
27 |
from rich.status import Status
|
28 |
from rich.tree import Tree
|
29 |
from .utils.config import load_task_desc, prep_agent_workspace, save_run, load_cfg
|
|
|
4 |
|
5 |
from . import backend
|
6 |
|
|
|
7 |
from .agent import Agent
|
8 |
from .interpreter import Interpreter
|
9 |
from .journal import Journal, Node
|
|
|
22 |
TimeRemainingColumn,
|
23 |
)
|
24 |
from rich.text import Text
|
|
|
25 |
from rich.status import Status
|
26 |
from rich.tree import Tree
|
27 |
from .utils.config import load_task_desc, prep_agent_workspace, save_run, load_cfg
|