Skip to content

Commit

Permalink
lint: fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
gventuri committed Oct 16, 2024
1 parent 2bc45ef commit 5839328
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 61 deletions.
56 changes: 28 additions & 28 deletions server/api/v1/workspace/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,66 +8,66 @@
from app.schemas.responses.users import WorkspaceUsersResponse
from app.schemas.responses.datasets import WorkspaceDatasetsResponseModel
from app.schemas.requests.workspace import WorkspaceCreateRequestModel
from typing import List

workspace_router = APIRouter()


@workspace_router.get("/list")
async def get_user_workspaces(
workspace_controller: WorkspaceController = Depends(
Factory().get_space_controller
),
user: UserInfo = Depends(get_current_user)):
workspace_controller: WorkspaceController = Depends(Factory().get_space_controller),
user: UserInfo = Depends(get_current_user),
):
return await workspace_controller.get_user_workspaces(user)


@workspace_router.get("/{workspace_id}/users", response_model=WorkspaceUsersResponse)
async def get_workspace_users(
workspace_id: UUID = Path(..., description="ID of the workspace"),
workspace_controller: WorkspaceController = Depends(
Factory().get_space_controller
),
user: UserInfo = Depends(get_current_user)):
workspace_controller: WorkspaceController = Depends(Factory().get_space_controller),
user: UserInfo = Depends(get_current_user),
):
return await workspace_controller.get_workspace_users(workspace_id)

@workspace_router.get("/{workspace_id}/datasets", response_model=WorkspaceDatasetsResponseModel)

@workspace_router.get(
"/{workspace_id}/datasets", response_model=WorkspaceDatasetsResponseModel
)
async def get_workspace_datasets(
workspace_id: UUID = Path(..., description="ID of the workspace"),
workspace_controller: WorkspaceController = Depends(Factory().get_space_controller)
):
workspace_id: UUID = Path(..., description="ID of the workspace"),
workspace_controller: WorkspaceController = Depends(Factory().get_space_controller),
):
return await workspace_controller.get_workspace_datasets(workspace_id)


@workspace_router.get("/{workspace_id}/details")
async def get_workspace_details(
workspace_id: UUID = Path(..., description="ID of the workspace"),
workspace_controller: WorkspaceController = Depends(Factory().get_space_controller)
):
workspace_id: UUID = Path(..., description="ID of the workspace"),
workspace_controller: WorkspaceController = Depends(Factory().get_space_controller),
):
return await workspace_controller.get_workspace_datails(workspace_id)


@workspace_router.delete("/{workspace_id}")
async def delete_workspace(
workspace_id: UUID = Path(..., description="ID of the workspace"),
workspace_controller: WorkspaceController = Depends(Factory().get_space_controller)
):
workspace_id: UUID = Path(..., description="ID of the workspace"),
workspace_controller: WorkspaceController = Depends(Factory().get_space_controller),
):
return await workspace_controller.delete_workspace(workspace_id)


@workspace_router.post("/add")
async def add_workspace(
workspace: WorkspaceCreateRequestModel,
workspace_controller: WorkspaceController = Depends(Factory().get_space_controller),
user: UserInfo = Depends(get_current_user)
):
workspace: WorkspaceCreateRequestModel,
workspace_controller: WorkspaceController = Depends(Factory().get_space_controller),
user: UserInfo = Depends(get_current_user),
):
return await workspace_controller.add_workspace(workspace, user)


@workspace_router.put("/{workspace_id}/edit")
async def edit_workspace(
workspace: WorkspaceCreateRequestModel,
workspace_id: UUID = Path(..., description="ID of the workspace"),
workspace_controller: WorkspaceController = Depends(Factory().get_space_controller),
):
return await workspace_controller.edit_workspace(workspace_id, workspace)
workspace: WorkspaceCreateRequestModel,
workspace_id: UUID = Path(..., description="ID of the workspace"),
workspace_controller: WorkspaceController = Depends(Factory().get_space_controller),
):
return await workspace_controller.edit_workspace(workspace_id, workspace)
1 change: 0 additions & 1 deletion server/core/fastapi/dependencies/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from .authentication import AuthenticationRequired
from .logging import Logging

__all__ = ["Logging"]
25 changes: 14 additions & 11 deletions server/ee/api/v1/logs/logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,22 @@

log_router = APIRouter()

@log_router.get("/", response_model=LogsResponseModel, dependencies=[Depends(check_logs_feature)])
async def get_logs(
skip: int = Query(0, alias="skip", description="Number of logs to skip"),
limit: int = Query(10, alias="limit", description="Max number of logs to return"),
user: UserInfo = Depends(get_current_user),

logs_controller: LogsController = Depends(Factory().get_logs_controller)
):
@log_router.get(
"/", response_model=LogsResponseModel, dependencies=[Depends(check_logs_feature)]
)
async def get_logs(
skip: int = Query(0, alias="skip", description="Number of logs to skip"),
limit: int = Query(10, alias="limit", description="Max number of logs to return"),
user: UserInfo = Depends(get_current_user),
logs_controller: LogsController = Depends(Factory().get_logs_controller),
):
return await logs_controller.get_logs(user.id, skip, limit)


@log_router.get("/{log_id}")
async def get_logs(
log_id: UUID = Path(..., description="ID of the log"),
logs_controller: LogsController = Depends(Factory().get_logs_controller)
):
async def get_log(
log_id: UUID = Path(..., description="ID of the log"),
logs_controller: LogsController = Depends(Factory().get_logs_controller),
):
return await logs_controller.get_log(log_id)
3 changes: 1 addition & 2 deletions server/main.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import os
import uvicorn
from dotenv import load_dotenv
from core.config import config

load_dotenv()

from core.config import config

if __name__ == "__main__":
uvicorn.run(
app="core.server:app",
Expand Down
19 changes: 2 additions & 17 deletions server/migrations/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from sqlalchemy import pool
from sqlalchemy.ext.asyncio import create_async_engine
from dotenv import load_dotenv
from app.models import Base
from core.config import config as app_config

load_dotenv()

Expand All @@ -21,28 +23,12 @@

print(parent_dir)


# Interpret the config file for Python logging.
# This line sets up loggers basically.
fileConfig(config.config_file_name)

# add your model's MetaData object here
# for 'autogenerate' support
# from myapp import mymodel
# target_metadata = mymodel.Base.metadata

from app.models import Base

# For auto generate schemas
from core.config import config as app_config

target_metadata = Base.metadata

# other values from the config, defined by the needs of env.py,
# can be acquired:
# my_important_option = config.get_main_option("my_important_option")
# ... etc.


def run_migrations_offline():
"""Run migrations in 'offline' mode.
Expand All @@ -53,7 +39,6 @@ def run_migrations_offline():
Calls to context.execute() here emit the given string to the
script output.
"""
url = config.get_main_option("sqlalchemy.url")
context.configure(
url=app_config.POSTGRES_URL,
target_metadata=target_metadata,
Expand Down
2 changes: 0 additions & 2 deletions tests/unit_tests/vectorstores/test_milvus.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import unittest
from unittest.mock import ANY, MagicMock, patch

import numpy as np # Assuming `encode_documents` returns `numpy` arrays

from pandasai.ee.vectorstores.milvus import Milvus

Expand Down Expand Up @@ -58,7 +57,6 @@ def test_add_question_answer_different_dimensions(self, mock_client):
@patch("pandasai.ee.vectorstores.milvus.MilvusClient", autospec=True)
def test_update_question_answer(self, mock_client):
milvus = Milvus()
ids = ["test id 1", "test id 2"]
milvus.update_question_answer(
["test id", "test id"],
["What is AGI?", "How does it work?"],
Expand Down

0 comments on commit 5839328

Please sign in to comment.