Skip to content

Commit

Permalink
refactor: Lint integrations-service (CI)
Browse files Browse the repository at this point in the history
  • Loading branch information
HamadaSalhab authored and github-actions[bot] committed Nov 14, 2024
1 parent 244f5f7 commit fb41003
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 10 deletions.
1 change: 1 addition & 0 deletions integrations-service/integrations/models/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class ExecutionError(BaseModel):
The error message of the integration execution
"""


ExecutionSetup = Union[
EmailSetup,
SpiderSetup,
Expand Down
5 changes: 3 additions & 2 deletions integrations-service/integrations/utils/integrations/brave.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import json

from beartype import beartype
from ...models.execution import ExecutionError
from langchain_community.tools import BraveSearch
from tenacity import retry, stop_after_attempt, wait_exponential

from ...autogen.Tools import BraveSearchArguments, BraveSearchSetup
from ...models import BraveSearchOutput, SearchResult
from ...models.execution import ExecutionError


@beartype
Expand All @@ -27,7 +27,8 @@ async def search(
assert isinstance(arguments, BraveSearchArguments), "Invalid arguments"

tool = BraveSearch.from_api_key(
api_key=setup.api_key, search_kwargs={"count": 3})
api_key=setup.api_key, search_kwargs={"count": 3}
)

result = tool.run(arguments.query)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
DebugConnectionURLs,
Session,
)
from ...models.execution import ExecutionError
from tenacity import retry, stop_after_attempt, wait_exponential

from ...autogen.Tools import (
Expand All @@ -32,6 +31,7 @@
BrowserbaseListSessionsOutput,
)
from ...models.browserbase import BrowserbaseExtensionOutput
from ...models.execution import ExecutionError


def get_browserbase_client(setup: BrowserbaseSetup) -> Browserbase | ExecutionError:
Expand Down
6 changes: 4 additions & 2 deletions integrations-service/integrations/utils/integrations/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
from smtplib import SMTP

from beartype import beartype
from ...models.execution import ExecutionError
from tenacity import retry, stop_after_attempt, wait_exponential

from ...autogen.Tools import EmailArguments, EmailSetup
from ...models import EmailOutput
from ...models.execution import ExecutionError


@beartype
Expand All @@ -15,7 +15,9 @@
reraise=True,
stop=stop_after_attempt(4),
)
async def send(setup: EmailSetup, arguments: EmailArguments) -> EmailOutput | ExecutionError:
async def send(
setup: EmailSetup, arguments: EmailArguments
) -> EmailOutput | ExecutionError:
"""
Sends an email with the provided details.
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
import uuid

from beartype import beartype
from ...models.execution import ExecutionError
from llama_parse import LlamaParse
from tenacity import retry, stop_after_attempt, wait_exponential

from ...autogen.Tools import LlamaParseFetchArguments, LlamaParseSetup
from ...models import LlamaParseFetchOutput
from ...models.execution import ExecutionError


@beartype
Expand Down Expand Up @@ -37,7 +37,7 @@ async def parse(
file_content = base64.b64decode(arguments.file)
extra_info = {
"file_name": arguments.filename if arguments.filename else str(uuid.uuid4())
}
}

# Parse the document
documents = await parser.aload_data(file_content, extra_info=extra_info)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from ...autogen.Tools import RemoteBrowserArguments, RemoteBrowserSetup
from ...models import RemoteBrowserOutput
from ...models.execution import ExecutionError

CURSOR_PATH = Path(__file__).parent / "assets" / "cursor-small.png"


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
reraise=True,
stop=stop_after_attempt(4),
)
async def get(setup: WeatherSetup, arguments: WeatherGetArguments) -> WeatherGetOutput | ExecutionError:
async def get(
setup: WeatherSetup, arguments: WeatherGetArguments
) -> WeatherGetOutput | ExecutionError:
"""
Fetches weather data for a specified location using OpenWeatherMap API.
"""
Expand All @@ -28,7 +30,9 @@ async def get(setup: WeatherSetup, arguments: WeatherGetArguments) -> WeatherGet
if not location:
raise ValueError("Location parameter is required for weather data")

weather = OpenWeatherMapAPIWrapper(openweathermap_api_key=openweathermap_api_key)
weather = OpenWeatherMapAPIWrapper(
openweathermap_api_key=openweathermap_api_key
)
result = weather.run(location)
return WeatherGetOutput(result=result)
except Exception as e:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
reraise=True,
stop=stop_after_attempt(4),
)
async def search(arguments: WikipediaSearchArguments) -> WikipediaSearchOutput | ExecutionError:
async def search(
arguments: WikipediaSearchArguments,
) -> WikipediaSearchOutput | ExecutionError:
"""
Searches Wikipedia for a given query and returns formatted results.
"""
Expand Down

0 comments on commit fb41003

Please sign in to comment.