Skip to content

Commit

Permalink
Code review
Browse files Browse the repository at this point in the history
  • Loading branch information
Jose Henrique Roveda committed Oct 24, 2023
1 parent ec3b093 commit 24b9e88
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 32 deletions.
1 change: 0 additions & 1 deletion .github/workflows/bandit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,3 @@ jobs:
# skips: # optional, default is DEFAULT
# path to a .bandit file that supplies command line arguments
# ini_path: # optional, default is DEFAULT

2 changes: 1 addition & 1 deletion .github/workflows/black.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
- uses: psf/black@stable
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ repos:
- id: reorder-python-imports

- repo: https://github.com/psf/black
rev: 23.10.0
rev: 23.10.1
hooks:
- id: black
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ The following API endpoints are available:
GET /v1/bible/books
```

**Return**:
**Return**:

Returns a list of all books in the Bible.

Expand Down Expand Up @@ -92,7 +92,7 @@ Available bible versions:


### Images created:
**NVI**:
**NVI**:

<img src="https://raw.githubusercontent.com/josehenriqueroveda/bible-art-maker/main/app/images/Isa%C3%ADas_54_16-17.jpg" width=720 class="inline"/>

Expand Down
2 changes: 1 addition & 1 deletion app/db/acf.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/db/nvi.json

Large diffs are not rendered by default.

14 changes: 8 additions & 6 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import os

from fastapi import FastAPI, Request
from fastapi.responses import HTMLResponse, JSONResponse
from fastapi import FastAPI
from fastapi import Request
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import HTMLResponse
from fastapi.responses import JSONResponse
from helpers.constants import API_IP
from helpers.constants import LIMITER
from routers.v1.art_maker_router import art_maker_router
from routers.v1.bible_router import bible_router
from slowapi import _rate_limit_exceeded_handler
from slowapi.errors import RateLimitExceeded
from uvicorn import run

from helpers.constants import LIMITER, API_IP
from routers.v1.bible_router import bible_router
from routers.v1.art_maker_router import art_maker_router


limiter = LIMITER
app = FastAPI(
Expand Down
3 changes: 2 additions & 1 deletion app/models/VerseRequest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from pydantic import BaseModel, validator
from pydantic import BaseModel
from pydantic import validator


class VerseRequest(BaseModel):
Expand Down
30 changes: 16 additions & 14 deletions app/routers/v1/art_maker_router.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
import logging
import os
import random
import logging
import textwrap

from fastapi import APIRouter, Request, BackgroundTasks
from fastapi.responses import FileResponse, JSONResponse
from PIL import Image, ImageDraw, ImageFont

from models.VerseRequest import VerseRequest
from fastapi import APIRouter
from fastapi import BackgroundTasks
from fastapi import Request
from fastapi.responses import FileResponse
from fastapi.responses import JSONResponse
from helpers.constants import BACKGROUND_IMAGE_DIR
from helpers.constants import BACKGROUND_IMAGE_MOBILE_DIR
from helpers.constants import BOOKS_DIR
from helpers.constants import LIMITER
from helpers.constants import LINE_SPACING
from helpers.constants import TEXT_COLOR
from models.Bible import Bible
from helpers.constants import (
BOOKS_DIR,
BACKGROUND_IMAGE_DIR,
BACKGROUND_IMAGE_MOBILE_DIR,
TEXT_COLOR,
LINE_SPACING,
LIMITER,
)
from models.VerseRequest import VerseRequest
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont

logger = logging.getLogger(__name__)

Expand Down
9 changes: 5 additions & 4 deletions app/routers/v1/bible_router.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import logging
from typing import List

from fastapi import APIRouter, Request
from fastapi import APIRouter
from fastapi import Request
from fastapi.responses import JSONResponse

from helpers.constants import BOOKS_DIR
from helpers.constants import LIMITER
from models.Bible import Bible
from models.VerseRequest import VerseRequest
from models.VerseResponse import VerseResponse
from models.Bible import Bible
from helpers.constants import BOOKS_DIR, LIMITER

logger = logging.getLogger(__name__)

Expand Down

0 comments on commit 24b9e88

Please sign in to comment.