Skip to content

Commit

Permalink
Merge pull request #218 from CambioML/dev
Browse files Browse the repository at this point in the history
Fix autoflake failure case and update pre-commit to run unittests
  • Loading branch information
CambioML authored Mar 11, 2024
2 parents 3784c09 + 9bfb1d1 commit cc1a754
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 7 deletions.
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,14 @@ repos:
- "--remove-all-unused-imports"
exclude: "uniflow/__init__.py"

# run all unittests
- repo: local
hooks:
- id: unittests
name: unittests
entry: ./run_tests.sh
language: script
# Optional: Specify types of files that trigger this hook
# types: [python]
# Optional: Specify files or directories to exclude
# exclude: '^docs/'
2 changes: 1 addition & 1 deletion example/vector_database/utils/aws_session.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import warnings
from typing import Any, Dict, List, Optional
from typing import Any, Dict


class AWSSession:
Expand Down
5 changes: 3 additions & 2 deletions example/vector_database/utils/bedrock_client.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import json
import os
import warnings
from typing import Any, Dict, List, Optional
from typing import Any, Dict


class BedrockEmbeddingClient:
Expand Down Expand Up @@ -32,6 +31,8 @@ def __init__(self, aws_session, loader_config: Dict[str, Any]) -> None:
# import in class level to avoid installing boto3
import boto3

boto3.__version__

self._bedrock_client = aws_session.client(
"bedrock-runtime", region_name=self._aws_region
)
Expand Down
3 changes: 1 addition & 2 deletions example/vector_database/utils/es_client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import warnings
from typing import Any, Dict, List, Optional
from typing import Any, Dict, List

from requests_aws4auth import AWS4Auth

Expand Down
5 changes: 3 additions & 2 deletions example/vector_database/utils/s3_client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
import warnings
from typing import Any, Dict, List, Optional
from typing import Any, Dict


class S3Client:
Expand All @@ -17,6 +16,8 @@ def __init__(self, aws_session, loader_config: Dict[str, Any]) -> None:
# import in class level to avoid installing boto3
import boto3

boto3.__version__

self._s3_client = aws_session.client("s3", region_name=self._aws_region)

except ImportError as e:
Expand Down
2 changes: 2 additions & 0 deletions run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
python -m unittest discover tests

0 comments on commit cc1a754

Please sign in to comment.