Skip to content

Commit

Permalink
Merge pull request #66 from sfc-gh-twhite/pyupgrades
Browse files Browse the repository at this point in the history
style(ruff): resolve deprecated imports and super invocation with args
  • Loading branch information
sfc-gh-alherrera authored Nov 27, 2024
2 parents 4e7377e + 50e496e commit 8d7ba43
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]
- uses: pre-commit/[email protected]
3 changes: 2 additions & 1 deletion agent_gateway/agents/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
import json
import logging
from abc import abstractmethod
from collections.abc import Sequence
from pathlib import Path
from typing import Any, Dict, List, Optional, Sequence, Tuple, Union
from typing import Any, Dict, List, Optional, Tuple, Union

import yaml
from chains.llm_chain import LLMChain
Expand Down
3 changes: 2 additions & 1 deletion agent_gateway/chains/llm_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

import logging
import warnings
from typing import Any, Dict, List, Optional, Sequence, Tuple, Union
from collections.abc import Sequence
from typing import Any, Dict, List, Optional, Tuple, Union

from langchain.callbacks.manager import (
AsyncCallbackManager,
Expand Down
3 changes: 2 additions & 1 deletion agent_gateway/gateway/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
import logging
import re
import threading
from typing import Any, Dict, List, Mapping, Optional, Sequence, Union, cast
from collections.abc import Sequence
from typing import Any, Dict, List, Mapping, Optional, Union, cast

from snowflake.connector.connection import SnowflakeConnection
from snowflake.snowpark import Session
Expand Down
3 changes: 2 additions & 1 deletion agent_gateway/gateway/output_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

import ast
import re
from typing import Any, Sequence, Tuple, Union
from collections.abc import Sequence
from typing import Any, Tuple, Union

from langchain.schema import OutputParserException

Expand Down
5 changes: 3 additions & 2 deletions agent_gateway/gateway/planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
import json
import logging
import re
from typing import Any, Optional, Sequence, Union
from collections.abc import Sequence
from typing import Any, Optional, Union
from uuid import UUID

from langchain.callbacks.base import AsyncCallbackHandler

from agent_gateway.executors.schema import Plan
from agent_gateway.gateway.constants import END_OF_PLAN
from agent_gateway.gateway.output_parser import (
ACTION_PATTERN,
Expand All @@ -29,7 +31,6 @@
instantiate_task,
)
from agent_gateway.gateway.task_processor import Task
from agent_gateway.executors.schema import Plan
from agent_gateway.tools.base import StructuredTool, Tool
from agent_gateway.tools.logger import gateway_logger
from agent_gateway.tools.utils import CortexEndpointBuilder, post_cortex_request
Expand Down
3 changes: 2 additions & 1 deletion agent_gateway/gateway/task_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@

import asyncio
import logging
from collections.abc import Collection
from dataclasses import dataclass
from typing import Any, Callable, Collection, Dict, List, Optional
from typing import Any, Callable, Dict, List, Optional

from agent_gateway.tools.logger import gateway_logger

Expand Down
4 changes: 1 addition & 3 deletions agent_gateway/tools/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,7 @@ def __init__(
self, name: str, func: Optional[Callable], description: str, **kwargs: Any
) -> None:
"""Initialize tool."""
super(Tool, self).__init__(
name=name, func=func, description=description, **kwargs
)
super().__init__(name=name, func=func, description=description, **kwargs)

@classmethod
def from_function(
Expand Down
2 changes: 1 addition & 1 deletion agent_gateway/tools/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Logger:

def __new__(cls):
if cls._instance is None:
cls._instance = super(Logger, cls).__new__(cls)
cls._instance = super().__new__(cls)
cls._instance.init()
return cls._instance

Expand Down
4 changes: 1 addition & 3 deletions agent_gateway/tools/snowflake_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,7 @@ def __init__(
self.FILE = semantic_model
self.STAGE = stage

gateway_logger.log(
logging.INFO, "Cortex Analyst Tool successfully initialized"
)
gateway_logger.log(logging.INFO, "Cortex Analyst Tool successfully initialized")

def __call__(self, prompt) -> Any:
return self.asearch(query=prompt)
Expand Down

0 comments on commit 8d7ba43

Please sign in to comment.