Skip to content

Commit

Permalink
feat: add autoflake to pre commit config
Browse files Browse the repository at this point in the history
  • Loading branch information
Sai krishna committed Oct 16, 2024
1 parent 28a74b4 commit 0cc0f8b
Show file tree
Hide file tree
Showing 13 changed files with 9 additions and 22 deletions.
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ repos:
- id: end-of-file-fixer
- id: check-yaml
- id: check-ast
- repo: https://github.com/PyCQA/autoflake
rev: v2.3.1
hooks:
- id: autoflake
args: [--remove-all-unused-imports, --in-place]
- repo: 'https://github.com/psf/black'
rev: 23.3.0
hooks:
Expand Down
1 change: 0 additions & 1 deletion backend/indexer/indexer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import tempfile
from concurrent.futures import Executor
from typing import Dict, List, Optional
Expand Down
1 change: 0 additions & 1 deletion backend/modules/dataloaders/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ def load_filtered_data(
Returns:
Iterator[List[LoadedDataPoint]]: An iterator of list of loaded data points.
"""
pass


def get_loader_for_data_source(type, *args, **kwargs) -> BaseDataLoader:
Expand Down
7 changes: 1 addition & 6 deletions backend/modules/metadata_store/prisma_store.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import asyncio
import json
import os
import random
import shutil
import string
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
from typing import TYPE_CHECKING, Any, Dict, List, Optional

from fastapi import HTTPException
from prisma import Prisma
from prisma.errors import RecordNotFoundError, UniqueViolationError

from backend.logger import logger
from backend.modules.metadata_store.base import BaseMetadataStore
from backend.settings import settings
from backend.types import (
AssociateDataSourceWithCollection,
AssociatedDataSources,
Expand All @@ -25,7 +21,6 @@
DataSource,
RagApplication,
)
from backend.utils import TRUEFOUNDRY_CLIENT

if TYPE_CHECKING:
# TODO (chiragjn): Can we import these safely even if the prisma client might not be generated yet?
Expand Down
1 change: 0 additions & 1 deletion backend/modules/parsers/multi_modal_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from langchain.docstore.document import Document
from langchain_core.language_models.chat_models import BaseChatModel
from langchain_core.messages import HumanMessage
from PIL import Image

from backend.logger import logger
from backend.modules.model_gateway.model_gateway import model_gateway
Expand Down
2 changes: 0 additions & 2 deletions backend/modules/parsers/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from langchain.docstore.document import Document

from backend.logger import logger
from backend.types import LoadedDataPoint

PARSER_REGISTRY = {}
PARSER_REGISTRY_EXTENSIONS = defaultdict(list)
Expand Down Expand Up @@ -51,7 +50,6 @@ async def get_chunks(
Returns:
typing.List[Document]: A list of Document objects, each representing a chunk of the file.
"""
pass


def get_parser_for_extension(
Expand Down
2 changes: 0 additions & 2 deletions backend/modules/parsers/video_parser.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import json
import os
import tempfile
from typing import Any, Dict, List
Expand All @@ -7,7 +6,6 @@
from moviepy.video.io.VideoFileClip import VideoFileClip

from backend.logger import logger
from backend.modules.model_gateway.model_gateway import model_gateway
from backend.modules.parsers.audio_parser import AudioParser
from backend.modules.parsers.multi_modal_parser import MultiModalParser
from backend.modules.parsers.parser import BaseParser
Expand Down
1 change: 1 addition & 0 deletions backend/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ python-multipart==0.0.9
opencv-python==4.9.0.80
pillow==10.3.0
aiofiles==24.1.0
autoflake==2.3.1

### prisma
prisma==0.13.1
Expand Down
3 changes: 1 addition & 2 deletions backend/server/routers/data_source.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import os
import shutil
from contextlib import asynccontextmanager
from urllib.parse import unquote

from fastapi import APIRouter, Depends, FastAPI, HTTPException
from fastapi import APIRouter
from fastapi.responses import JSONResponse

from backend.logger import logger
Expand Down
1 change: 0 additions & 1 deletion backend/server/routers/internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from fastapi import APIRouter, File, Form, HTTPException, Query, UploadFile
from fastapi.responses import JSONResponse
from truefoundry import ml
from truefoundry.ml import DataDirectory

from backend.logger import logger
Expand Down
2 changes: 1 addition & 1 deletion backend/types.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import enum
import uuid
from enum import Enum
from typing import Any, Dict, List, Literal, Optional, Union
from typing import Any, Dict, List, Literal, Optional

from pydantic import (
BaseModel,
Expand Down
1 change: 0 additions & 1 deletion deployment/indexer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from truefoundry.deploy import (
Build,
DockerFileBuild,
Helm,
Job,
LocalSource,
Manual,
Expand Down
4 changes: 0 additions & 4 deletions deployment/unstructured_io.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import argparse
import json
import logging

from truefoundry.deploy import Image, NodeSelector, Port, Resources, Service

from deployment.config import UNSTRUCTURED_IO_SERVICE_NAME
Expand Down

0 comments on commit 0cc0f8b

Please sign in to comment.