Skip to content

Commit

Permalink
Add pre-commit config
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafael Marques committed Jul 14, 2024
1 parent 9a4d4ec commit 0a5deae
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,23 @@ on:
pull_request: {}

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4

- name: set up python
uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: install deps
run: pip install -r requirements-test.txt

- uses: pre-commit/action@v3.0.1
with:
extra_args: --all-files
test:
name: test py${{ matrix.python }} on ${{ matrix.os }}
strategy:
Expand Down
24 changes: 24 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-yaml
args: ['--unsafe']
- id: check-toml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: local
hooks:
- id: lint
name: Lint
entry: ruff check pydantic_settings_aws
types: [python]
language: system
pass_filenames: false
- id: mypy
name: Mypy
entry: mypy pydantic_settings_aws
types: [python]
language: system
pass_filenames: false
6 changes: 4 additions & 2 deletions pydantic_settings_aws/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


def get_secrets_content(settings: type[BaseSettings]) -> dict[str, Any]:
client: SecretsManagerClient | None = _get_boto3_client(settings)
client: SecretsManagerClient = _get_boto3_client(settings)
secrets_args: AwsSecretsArgs = _get_secrets_args(settings)

logger.debug("Getting secrets manager value with boto3 client")
Expand Down Expand Up @@ -98,7 +98,9 @@ def _get_secrets_args(settings: type[BaseSettings]) -> AwsSecretsArgs:
raise err


def _get_secrets_content(secret: dict[str, Any]) -> Optional[str]:
def _get_secrets_content(
secret: GetSecretValueResponseTypeDef,
) -> Optional[str]:
secrets_content: Optional[str] = None

if "SecretString" in secret and secret.get("SecretString"):
Expand Down

0 comments on commit 0a5deae

Please sign in to comment.