Skip to content

Commit

Permalink
fix pre-commit errors
Browse files Browse the repository at this point in the history
  • Loading branch information
lwaekfjlk committed May 30, 2024
1 parent a4001eb commit 794f204
Show file tree
Hide file tree
Showing 21 changed files with 33 additions and 31 deletions.
2 changes: 1 addition & 1 deletion research_town/agents/agent_base.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from datetime import datetime
from beartype.typing import Any, Dict, List, Tuple

from beartype import beartype
from beartype.typing import Any, Dict, List, Tuple

from ..dbs import (
AgentAgentDiscussionLog,
Expand Down
2 changes: 1 addition & 1 deletion research_town/dbs/agent_db.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
import uuid
from beartype.typing import Any, Dict, List, Optional

from beartype.typing import Any, Dict, List, Optional
from pydantic import BaseModel, Field


Expand Down
2 changes: 1 addition & 1 deletion research_town/dbs/env_db.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
import uuid
from beartype.typing import Any, Dict, List, Optional, Type, TypeVar

from beartype.typing import Any, Dict, List, Optional, Type, TypeVar
from pydantic import BaseModel, Field

T = TypeVar('T', bound=BaseModel)
Expand Down
2 changes: 1 addition & 1 deletion research_town/dbs/paper_db.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
import uuid
from beartype.typing import Any, Dict, List, Optional

from beartype.typing import Any, Dict, List, Optional
from pydantic import BaseModel, Field

from ..utils.paper_collector import get_daily_papers
Expand Down
2 changes: 1 addition & 1 deletion research_town/dbs/progress_db.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
import uuid
from beartype.typing import Any, Dict, List, Optional, Type, TypeVar

from beartype.typing import Any, Dict, List, Optional, Type, TypeVar
from pydantic import BaseModel, Field

T = TypeVar('T', bound=BaseModel)
Expand Down
3 changes: 1 addition & 2 deletions research_town/envs/env_paper_rebuttal.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from beartype.typing import Dict, List, Tuple

from beartype import beartype
from beartype.typing import Dict, List, Tuple

from ..dbs import (
AgentPaperMetaReviewLog,
Expand Down
3 changes: 1 addition & 2 deletions research_town/envs/env_paper_submission.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from beartype.typing import Dict, List

from beartype import beartype
from beartype.typing import Dict, List

from ..agents.agent_base import BaseResearchAgent
from ..dbs import (
Expand Down
1 change: 0 additions & 1 deletion research_town/evaluators/output_format.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

from beartype.typing import Type, TypeVar

from pydantic import BaseModel, Extra, Field, validator

T = TypeVar('T', bound=BaseModel)
Expand Down
1 change: 1 addition & 0 deletions research_town/evaluators/quality_evaluator.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

import re

from beartype.typing import Any

from ..utils.decorator import parsing_error_exponential_backoff
Expand Down
3 changes: 1 addition & 2 deletions research_town/utils/agent_collector.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from beartype.typing import Any, Dict, List, Tuple

from arxiv import Client, Search
from beartype.typing import Any, Dict, List, Tuple
from tqdm import tqdm


Expand Down
3 changes: 1 addition & 2 deletions research_town/utils/agent_prompter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from beartype.typing import Dict, List, Union

from beartype import beartype
from beartype.typing import Dict, List, Union

from .model_prompting import model_prompting
from .paper_collector import get_related_papers
Expand Down
9 changes: 8 additions & 1 deletion research_town/utils/decorator.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import math
import time
from functools import wraps
from beartype.typing import Any, Callable, List, Optional, TypeVar, cast

from beartype.typing import (
Any,
Callable,
List,
Optional,
TypeVar,
cast,
)
from pydantic import BaseModel

INF = float(math.inf)
Expand Down
3 changes: 1 addition & 2 deletions research_town/utils/eval_prompter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from beartype.typing import Dict

from beartype import beartype
from beartype.typing import Dict

from .model_prompting import model_prompting

Expand Down
1 change: 1 addition & 0 deletions research_town/utils/logging.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging

from beartype.typing import Dict, List, Union

logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
Expand Down
3 changes: 1 addition & 2 deletions research_town/utils/model_prompting.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from beartype.typing import List, Optional

import litellm
from beartype import beartype
from beartype.typing import List, Optional

from .decorator import api_calling_error_exponential_backoff

Expand Down
2 changes: 1 addition & 1 deletion research_town/utils/paper_collector.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import datetime
from beartype.typing import Any, Dict, List, Tuple
from xml.etree import ElementTree

import arxiv
import faiss
import requests
import torch
from beartype.typing import Any, Dict, List, Tuple
from transformers import BertModel, BertTokenizer

ATOM_NAMESPACE = "{http://www.w3.org/2005/Atom}"
Expand Down
2 changes: 1 addition & 1 deletion research_town/utils/serializer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import importlib
from beartype.typing import Any, Dict, List, Set, Tuple, Union

from beartype.typing import Any, Dict, List, Set, Tuple, Union
from pydantic import BaseModel


Expand Down
1 change: 1 addition & 0 deletions research_town/utils/tools.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import datetime
import json
import os

from beartype.typing import Any, Dict


Expand Down
2 changes: 1 addition & 1 deletion tests/test_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,4 @@ def test_discuss(mock_model_prompting: MagicMock) -> None:
assert response.agent_to_pk is not None
assert response.agent_from_pk is not None
assert response.timestep >= 0
assert response.pk is not None
assert response.pk is not None
15 changes: 7 additions & 8 deletions tests/test_dbs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from unittest.mock import patch

from beartype.typing import Any, Dict, Optional

from research_town.dbs.agent_db import AgentProfile, AgentProfileDB
from research_town.dbs.env_db import (
Expand All @@ -14,17 +15,16 @@
ResearchProgressDB,
)

from beartype.typing import Optional, Dict, Any

def test_envlogdb_basic()->None:
db = EnvLogDB()
review_log = AgentPaperReviewLog(paper_pk="paper1", agent_pk="agent1", review_score=5, review_content="Good paper")
rebuttal_log = AgentPaperRebuttalLog(paper_pk="paper1", agent_pk="agent1", rebuttal_content="I disagree with the review")
meta_review_log = AgentPaperMetaReviewLog(paper_pk="paper1", agent_pk="agent1", decision=True, meta_review="Accept")
discussion_log = AgentAgentDiscussionLog(
agent_from_pk="agent1",
agent_from_pk="agent1",
agent_from_name='Rex Ying',
agent_to_pk="agent2",
agent_to_pk="agent2",
agent_to_name='John Doe',
message="Let's discuss this paper"
)
Expand Down Expand Up @@ -100,11 +100,11 @@ def test_agentprofiledb_basic()->None:

success = db.delete("non-existing-pk")
assert not success

conditions: Dict[str, Any] = {"name": "Jane Smith"}

results = db.get(**conditions)

assert len(results) == 1
assert results[0].name == "Jane Smith"

Expand Down Expand Up @@ -216,7 +216,7 @@ def test_researchprogressdb_basic()->None:

db.add(idea1)
db.add(idea2)

new_idea = ResearchIdea(content="Blockchain research proposal")
db.add(new_idea)
assert new_idea.dict() in db.data["ResearchIdea"]
Expand Down Expand Up @@ -249,4 +249,3 @@ def test_researchprogressdb_basic()->None:
new_db.load_from_file(file_name)

assert len(new_db.data["ResearchIdea"]) == 2

2 changes: 1 addition & 1 deletion tests/test_eval.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from beartype.typing import Any
from unittest.mock import MagicMock, patch

import pytest
from beartype.typing import Any

from research_town.evaluators.quality_evaluator import (
IdeaQualityEvaluator,
Expand Down

0 comments on commit 794f204

Please sign in to comment.